package com.gzx.plugin.tjzy.feign.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gzx.tjzy.feign.resp.project.GzxProjectRespDto;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author zjt
 */
public interface GzxProjectFeignMapper extends BaseMapper<GzxProjectRespDto> {

    /**
     * 获取有案件的项目列表
     */
    @Select("<script>" +
            "SELECT distinct p.project_code projectCode,project_name projectName FROM `gzx_project` p inner join gzx_case c on p.project_code = c.project_code " +
            " where c.create_time between DATE_FORMAT(CURDATE() - INTERVAL 1 MONTH, '%Y-%m-01 00:00:00') and DATE_FORMAT(LAST_DAY(CURDATE()), '%Y-%m-%d 23:59:59') " +
            "</script>")
    List<GzxProjectRespDto> listCaseProject();

    /**
     * 获取所有项目的在催案件量和在催人力
     */
    @Select("<script>" +
            "SELECT distinct project_code projectCode,project_name projectName,debt_user debtUser,case_load caseLoad FROM `gzx_project` " +
            " where delete_flag = 'NOT_DELETE' " +
            "</script>")
    List<GzxProjectRespDto> listCaseDebt();
}
